﻿using Kernelx.Common.Clauses;
using System;
using System.Linq.Expressions;

namespace Kernelx.Contexts.Defaults
{
    /// <summary>
    ///  定义<see cref="IClauseElement"/> 与<see cref="Expression"/> 之间的转换关系,有默认实现,可重实现
    /// </summary>
    public interface IClauseConverter
    {

        /// <summary>
        /// 
        /// </summary>
        /// <param name="clause"></param>
        /// <param name="targetType"></param>
        /// <param name="parameter"></param>
        /// <returns></returns>
        LambdaExpression CreateLambdaExpression(IClauseElement clause, Type targetType, ParameterExpression parameter = null);

        /// <summary>
        /// 
        /// </summary>
        /// <param name="expr"></param>
        /// <returns></returns>
        IClauseElement CreateClauseElement(Expression expr);

    }
}
